<template>
  <div id="app">
    <div class="main">
      <div class="tabs">
        <div class="drawer-menu">
          <template v-for="(item, index) in menu" :key="index">
            <div
              class="tabs-item"
              :class="{ active: activeIndex === index }"
              @click="changeCard(item.component, (activeIndex = index))"
            >
              <div class="item-text">{{ item.label }}</div>
            </div>
          </template>
        </div>
      </div>
      <div class="tabs-pane">
        <el-scrollbar>
          <slot name="base-body"></slot>
          <div class="detail-main">
            <slot name="detail-body"></slot>
          </div>
        </el-scrollbar>
      </div>
      <div class="drawer-close-btn"></div>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'

const activeIndex = ref(0)
const props = defineProps({
  menu: {
    type: Array,
    required: true,
  },
  changeCard: {
    type: Function,
    required: true,
  },
})
console.log(props.menu)
</script>
<style scoped lang="scss">
.main {
  display: flex;
  position: relative;
  overflow: visible;
}

.drawer-close-btn {
  width: 30px;
  height: 30px;
  position: absolute;
  background-color: #0052cc;
  left: -30px;
  z-index: 9999999;
}

.tabs {
  width: 115px;
  height: calc(100vh - 20px);
}

.drawer-menu {
  display: flex;
  align-items: center;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 10px 10px;
}

.tabs-item {
  align-items: center;
  box-sizing: border-box;
  color: var(--el-text-color-primary);
  display: flex;
  font-size: var(--el-font-size-base);
  font-weight: 500;
  height: var(--el-tabs-header-height);
  justify-content: center;
  list-style: none;
  padding: 8px 20px;
  position: relative;
}

.item-text {
  background-color: #ebecf0;
  border-radius: 4px;
  height: 25px;
  line-height: 25px;
  padding: 0 4px;
  width: 60px;
  color: black;
  text-align: right;
}

.tabs-item::after {
  background-color: #e4e9f2;
  border-radius: 4px;
  content: '';
  height: 8px;
  position: absolute;
  right: 2px;
  top: 16px;
  width: 8px;
  z-index: 1;
}

.tabs-item:hover .item-text,
.tabs-item.active .item-text {
  background-color: var(--el-text-color-primary);
  color: white;
}

.tabs-pane {
  width: 100%;
  height: 100vh;
  /* padding: 0 10px; */
}

.item-header {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px #172b4d1a;
  margin: 16px 8px 0;
  overflow: hidden;
  padding: 16px;
}

.detail-header {
  padding: 0;
}

.detail-body {
  display: flex;
}

.detail-header-subtitle {
  color: #6b778c;
  font-size: 14px;
  margin-bottom: 2px;
}

.detail-header-body {
  align-items: center;
  display: flex;
  justify-content: space-between;
  text-align: left;
  width: 100%;
  flex-direction: row;
}

.detail-header-left,
.detail-header-right {
  align-items: center;
  display: flex;
}

.drawer-btn {
  width: 32px;
  height: 30px;
}

.detail-header-title {
  display: flex;
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.focus-icon {
  color: #dfe1e6;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  margin-left: 16px;
}

.detail-base {
  margin: 12px 0 0;
  width: auto;
  position: relative;
}

.base-item {
  align-items: center;
  display: flex;
  min-height: 24px;
  overflow: hidden;
}

.base-title {
  color: #6b778c;
  margin-right: 8px;
  font-size: 14px;
}

.text-one-line {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tags-content {
  margin-top: 8px;
}

.tag-view {
  display: flex;
  flex-wrap: wrap;
}

.tag-referene {
  border: none;
  width: 14px;
  height: 14px;
  padding: 2px;
}

.detail-body-left {
  flex: 1;
  min-width: 20px;
  width: 0;
}

.detail-body-main {
  height: auto;
  margin: 16px 8px;
  border-radius: 12px;
  padding: 16px;
  background-color: #fff;
  box-shadow: 0 2px 8px #172b4d1a;
  overflow: hidden;
}

.avatar {
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  margin-right: 8px;
  margin-top: 5px;
}

.log-add {
  align-items: center;
  display: flex;
  text-align: left;
  width: 100%;
}

.log-content {
  flex: 1;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.log-content--expanded {
  max-height: 500px; /* Adjust this value based on your content height */
}

.log-content .mix-content {
  padding: 8px 16px 24px;
}

.form-container {
  display: flex;
  text-align: left;
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: row;
  gap: 24px;
}

.file-content {
  display: flex;
}

.control-item {
  margin-right: 20px;
}

.send-bar {
  margin-top: 16px;
}

.mix-content {
  color: #7a869a;
  cursor: text;
  padding: 0;
  border: 1px solid #dfe1e6;
  border-radius: 4px;
  /* padding: 8px 16px 24px; */
  position: relative;
  flex-direction: row;
}

.i-cont {
  line-height: 40px;
  padding: 0 24px;
}

.log {
  margin-top: 40px;
  position: relative;
}

.log-filter {
  height: 40px;
  width: 100%;
  align-items: center;
  display: flex;
  text-align: left;
  flex-direction: row;
  justify-content: space-between;
}

.filter-left {
  width: unset;
}

.filter-text {
  font-size: 14px;
}

.filter-right {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}
</style>
